﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once

#include "GcmpGeometryInterface.h"
#include "WeakReferenceable.h"

namespace gcmp
{
    class ICurve2d;
    class IPolygon;
    class IBody;
    class Vector2d;
    class Vector3d;

    class IExtremum : public WeakReferenceable
    {
    public:
        virtual ~IExtremum() {}

    public:
        /// \brief  计算二维曲线在指定方向上的极值点
        /// \param const ICurve2d *pCurve2d          二维曲线
        /// \param const Vector2d &unitDir             二维单位向量
        /// \param Vector2d &minPoint                 最小值点
        /// \param Vector2d &maxPoint                 最大值点
        /// \return   成功返回True，失败返回False
        virtual bool Calculate(const ICurve2d *pCurve2d, const Vector2d &unitDir, Vector2d &minPoint, Vector2d &maxPoint) const = 0;

        /// \brief  计算多边形在指定方向上的极值点
        /// \param const IPolygon *pPolygon           多边形
        /// \param const Vector2d &unitDir             二维单位向量
        /// \param Vector2d &minPoint                 最小值点
        /// \param Vector2d &maxPoint                 最大值点
        /// \return   成功返回True，失败返回False
        virtual bool Calculate(const IPolygon *pPolygon, const Vector2d &unitDir, Vector2d &minPoint, Vector2d &maxPoint) const = 0;

        /// \brief  计算体在指定方向上的极值点
        /// \param const IBody *pBody                 体
        /// \param const Vector3d &unitDir             三维单位向量
        /// \param Vector3d &minPoint                 最小值点
        /// \param Vector3d &maxPoint                 最大值点
        /// \return   成功返回True，失败返回False
        virtual bool Calculate(const IBody *pBody, const Vector3d &unitDir, Vector3d &minPoint, Vector3d &maxPoint) const = 0;
        
    };
}
